import React,{Component} from 'react';
import {Link} from 'react-router-dom';
import './commingSoonList.css';
class CommingSoonList extends Component{
	
	//时间戳的转换  哪里用到哪里调就可以
	formatDate(now) {
		let d = new Date(now);
        let month = d.getMonth() + 1;
        let date = d.getDate();
        return month + "月" + date + "日" ;
       }
	render(){
		return(
				<ul className="commingSoonList">
					{
						this.props.commingSoonList.map((item)=>
						<li key = {item.id}>
						<Link to={'/detail/'+item.id}>
							<div>
								<img src={item.cover.origin} alt={item.name}/>
							</div>
							<div className='commingSoonList-name'>
								<span>{item.name}</span>
								<span>{this.formatDate(item.premiereAt)}上映</span>
							</div>
						</Link>
						</li>
						)
					}
					<div className="more-button">更多即将上映电影</div>
				</ul>
		)
	}
}



//输出
export default CommingSoonList;